package com.ml.mall.api.delivery;

import com.ml.mall.api.BaseController;
import com.ml.mall.bean.base.ApiRestResult;
import com.ml.mall.bean.req.delivery.DeliveryEditReq;
import com.ml.mall.bean.req.delivery.DeliveryNewReq;
import com.ml.mall.consts.PermissionConst;
import com.ml.mall.enums.RetStatusNum;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import javax.validation.Valid;
import java.util.List;
import com.ml.mall.annotations.OperLog;
import com.ml.mall.service.delivery.SysOrderDeliveryService;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
*  前端控制器
* </p>
*
* @author kyyang
* Created 2021-05-29
*/

@Api(tags = "【order】物流信息")
@RestController
@RequestMapping("/delivery")
public class SysOrderDeliveryController extends BaseController{

     @Autowired
     private SysOrderDeliveryService sysOrderDeliveryService;


    @RequestMapping(method = RequestMethod.POST, path = "/new")
    @OperLog(operDesc = "创建卖家物流", operModul = "delivery", operType = "new")
    @ApiOperation("创建卖家物流")
//    @RequiresPermissions(PermissionConst.DELIVERY_NEW)
    public ApiRestResult sysOrderDeliveryNew(@Valid @RequestBody DeliveryNewReq req ) {
        return ApiRestResult.ok(sysOrderDeliveryService.sysOrderDeliveryNew(req));
    }

    @PostMapping(path = "/edit")
    @OperLog(operDesc = "编辑卖家物流", operModul = "delivery", operType = "edit")
    @ApiOperation("编辑卖家物流")
//    @RequiresPermissions(PermissionConst.DELIVERY_EDIT)
    public ApiRestResult sysOrderDeliveryEdit(@Valid @RequestBody DeliveryEditReq req){
        return ApiRestResult.ok(sysOrderDeliveryService.sysOrderDeliveryEdit(req));
    }
}
